package com.china.produce.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/6/22
 */
@ControllerAdvice
public class ControllerHandler {

    @ModelAttribute
    public void fillData(Model model) {
        model.addAttribute("wx", "foo.com");
    }

    @ExceptionHandler
    public String errorHandler(Exception e) {

        return "error";
    }
}
